package com.briup.web.controller;

import com.briup.exception.SystemException;
import com.briup.result.PageTemplate;
import com.briup.result.Result;
import com.briup.service.LogService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/log")
public class LogController {
    @Autowired
    private LogService service;
    @GetMapping("/page")
    @ApiOperation("分页获取日志信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页大小"),
            @ApiImplicitParam(name = "originalIp",value = "源IP")
    })
    public Result queryPageList(Integer pageNum,Integer pageSize,String originalIp) throws SystemException {
        //调用Service层方法
        PageTemplate pageTemplate = service.queryPageList(pageNum,pageSize,originalIp);
        //返回统一响应（携带数据）
        return Result.success(pageTemplate);
    }
}
